﻿using IdentityServer4.Models;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using Volo.Abp.DependencyInjection;
using Xms.Abp.Caching;

namespace IdentityServerManagement;

public class IdentityServerCacheContext : CacheContext<IdentityServerCacheContext>, IIdentityServerCacheContext, ITransientDependency
{
    public IdentityServerCacheContext(IAbpLazyServiceProvider lazyServiceProvider, IOptions<DistributedCacheProviderOptions> optionsAccessor, IEnumerable<ICacheProvider<IdentityServerCacheContext>> cacheProviders)
        : base(lazyServiceProvider, optionsAccessor, cacheProviders)
    {
    }

    public IKeyValueCache<IdentityResource> IdentityResources => KeyValue<IdentityResource>();

    public IKeyValueCache<ApiScope> ApiScopes => KeyValue<ApiScope>();

    public IKeyValueCache<ApiResource> ApiResources => KeyValue<ApiResource>();

    public IKeyValueCache<Resources> Resources => KeyValue<Resources>();

    public IKeyValueCache<Client> Clients => KeyValue<Client>();

    public IKeyValueCache<AllowedCorsOriginsCacheItem> AllowedCorsOrigins => KeyValue<AllowedCorsOriginsCacheItem>();
}
